<?php

namespace App\Console;

use App\Console\Commands\AssignOrderCommand;
use App\Console\Commands\ModifyOrderAppraiseCommand;
use App\Console\Commands\OrderWarningCommand;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        //生成指派订单
//        AssignOrderCommand::class,
        //修改订单评价状态为已评价
        ModifyOrderAppraiseCommand::class,
        // 标记预警订单
        OrderWarningCommand::class
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        //生成指派订单-每分钟执行一次
//        $schedule->command('assignOrder')->everyMinute();
        //修改订单评价状态为已评价-每分钟执行一次
        $schedule->command('order:auto-appraise')->everyTwoHours();
        // 标记预警订单
        $schedule->command('order:warning')->everyFiveMinutes();
    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }
}
